home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / prog / dnalib59.arj / DBLBOX.BAS < prev    next >
BASIC Source File  |  1993-11-17  |  4KB  |  156 lines

  1. DECLARE SUB LineEdit(Allow$,Text$,Mouse%,MouseRow%,MouseCol%,Fill%,Row%,Col%,EditKey%,Attr%)
  2. DECLARE SUB Popwind(Title$,Toprow%,Leftcolumn%,Bottomrow%,Rightcolumn%,Attr%,Shadow%,Border%)
  3. DECLARE SUB RestoreScreen(ScreenID$,TopRow%,LeftColumn%)
  4. DECLARE SUB SaveScreen(ScreenID$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Shadow%)
  5. DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
  6. DECLARE SUB Clicked(Rgt%,Lft%,Row%,Col%)
  7. DECLARE SUB HideCursor()
  8. DECLARE SUB ShowCursor()
  9.  
  10. SUB DoubleBox(PromptOne$,PromptTwo$,TextOne$,TextTwo$,Allow$,Mouse%,Editkey%,Fill%,Location%,ButtonAttr%,TextAttr%,Attr%,Shadow%,Border%)PUBLIC
  11.  
  12. CalcByte Attr%,FGround%,BGround%
  13. CalcByte ButtonAttr%,BtFG%,BtBG%
  14.  
  15. IF Mouse% THEN HideCursor
  16.  
  17. IF LEN(PromptOne$) > LEN(PromptTwo$) THEN
  18.   Prompt$ = PromptOne$
  19. ELSE
  20.   Prompt$ = PromptTwo$
  21. END IF
  22.  
  23. Finished% = 0
  24.  
  25. LeftColumn% = 40 - ((LEN(Prompt$) + LEN(TextOne$) + 5) \ 2)
  26. RightColumn% = LeftColumn% + (LEN(Prompt$) + LEN(TextOne$) + 4)
  27.  
  28. SaveScreen DbScreen$,Location%,LeftColumn%,Location% + 7,RightColumn%,Shadow%
  29.  
  30. Popwind Title$,Location%,LeftColumn%,Location% + 7,RightColumn%,Attr%,Shadow%,Border%
  31.  
  32. COLOR FGround%,BGround%
  33. LOCATE Location% + 1,LeftColumn% + 2,0
  34. PRINT PromptOne$;
  35. LOCATE Location% + 3,LeftColumn% + 2,0
  36. PRINT PromptTwo$;
  37.  
  38. Row% = Location% + 5
  39. Col% = LeftColumn% + 3
  40.  
  41. IF Mouse% THEN
  42.   COLOR FGround%,BGround%
  43.   LOCATE Location%,LeftColumn% + 2,0
  44.   PRINT CHR$(91,254,93);
  45. END IF
  46.  
  47.  COLOR BtFG%,BtBG%
  48.  LOCATE Row%, Col%,0
  49.  PRINT " Ok ";
  50.  COLOR 0,BGround%
  51.  LOCATE Row%, Col% + 4,0
  52.  PRINT "▄";
  53.  COLOR 0,BGround%
  54.  LOCATE Row% + 1,Col% + 1,0
  55.  PRINT "▀▀▀▀";
  56.  
  57.  COLOR BtFG%,BtBG%
  58.  LOCATE Row%,Col% + 9,0
  59.  PRINT " Esc ";
  60.  COLOR 0,BGround%
  61.  LOCATE Row%,Col% + 14,0
  62.  PRINT "▄";
  63.  COLOR 0,BGround%
  64.  LOCATE Row% + 1,Col% + 10,0
  65.  PRINT "▀▀▀▀▀"
  66.  
  67. DO
  68.  
  69. MouseRow% = 0
  70. MouseCol% = 0
  71.  
  72. LineEdit Allow$,TextOne$,Mouse%,MouseRow%,MouseCol%,Fill%,Location% + 1,LeftColumn% + LEN(Prompt$) + 3,EditKey%,TextAttr%
  73.  
  74. IF Mouse% THEN
  75.   IF Editkey% = -255 THEN
  76.     IF MouseRow% <> (Location% + 3) THEN GOTO CheckMouse
  77.   END IF
  78. END IF
  79.  
  80. IF Editkey% = 27 THEN GOTO KeyExit
  81.  
  82. MouseRow% = 0
  83. MouseCol% = 0
  84.  
  85. LineEdit Allow$,TextTwo$,Mouse%,MouseRow%,MouseCol%,Fill%,Location% + 3,LeftColumn% + LEN(Prompt$) + 3,EditKey%,TextAttr%
  86.  
  87. CheckMouse:
  88.  
  89. IF Editkey% = 255 THEN Editkey% = 0
  90.  
  91. IF Mouse% THEN  'stop here and check if exit was with mouse
  92.   ShowCursor
  93.   IF Row% = MouseRow% THEN
  94.     SELECT CASE MouseCol%
  95.  
  96.       CASE Col% TO Col% + 3
  97.         Editkey% = 13
  98.         Finished% = 1
  99.  
  100.       CASE Col% + 9 TO Col% + 13
  101.         Editkey% = 27
  102.         Finished% = 1
  103.  
  104.     END SELECT
  105.   ELSEIF Location% = MouseRow% THEN
  106.     IF MouseCol% = LeftColumn% + 3 THEN
  107.       Editkey% = 27
  108.       Finished% = 1
  109.     END IF
  110.   ELSE
  111.    IF Editkey% = 13 OR Editkey% = 27 THEN
  112.      Finished% = 1
  113.    END IF
  114.   END IF
  115. ELSE
  116.   IF Editkey% = 13 OR Editkey% = 27 THEN Finished% = 1
  117. END IF
  118.  
  119. LOOP UNTIL Finished%
  120.  
  121. KeyExit:
  122.  
  123. SELECT CASE Editkey%
  124.  
  125.     CASE 13 'Ok
  126.           IF Mouse% THEN HideCursor
  127.           COLOR FGround%,BGround%
  128.           LOCATE Row%,Col%,0
  129.           PRINT " ";
  130.           LOCATE Row% + 1,Col% + 1,0
  131.           PRINT "    ";
  132.       COLOR BtFG%,BtBG%
  133.           LOCATE Row%,Col% + 1,0
  134.           PRINT " Ok "
  135.  
  136.     CASE 27 'Esc
  137.           IF Mouse% THEN HideCursor
  138.           COLOR FGround%,BGround%
  139.           LOCATE Row%,Col% + 9,0
  140.           PRINT " ";
  141.           LOCATE Row% + 1,Col% + 10,0
  142.           PRINT "      ";
  143.       COLOR BtFG%,BtBG%
  144.           LOCATE Row%,Col% + 10,0
  145.           PRINT " Esc "
  146.  
  147. END SELECT
  148.  
  149. IF Mouse% THEN ShowCursor
  150. DELAY .5
  151. IF Mouse% THEN HideCursor
  152. RestoreScreen DbScreen$,Location%,LeftColumn%
  153.  
  154. END SUB
  155.  
  156.